# Maintainer: Jan Alexander Steffens (heftig) <jan.steffens@gmail.com>
# Contributor: Jan de Groot <jgc@archlinux.org>

# ALARM: Kevin Mihelich <kevin@archlinuxarm.org>
#  - patch to enable linking with libm to fix FTBFS

pkgname=gnome-power-manager
pkgver=3.32.0
pkgrel=2
pkgdesc="System power information and statistics"
url="https://gitlab.gnome.org/GNOME/gnome-power-manager"
arch=(x86_64)
license=(GPL)
depends=(gtk3 upower dconf)
makedepends=(git meson)
_commit=147464788853d4d5eb35514d7597cf22a24b5af1  # tags/GNOME_POWER_MANAGER_3_32_0^0
source=("git+https://gitlab.gnome.org/GNOME/gnome-power-manager.git#commit=$_commit"
        '0001-set-libm-as-required.patch')
sha256sums=('SKIP'
            '3a70f134c17d649e1c3aeafe84b5e453c7c2a9da828c5dd7992050852c96b465')

pkgver() {
  cd $pkgname
  git describe --tags | sed 's/^GNOME_POWER_MANAGER_//;s/_/./g;s/-/+/g'
}

prepare() {
  cd $pkgname
  git apply ../0001-set-libm-as-required.patch
}

build() {
  arch-meson $pkgname build
  ninja -C build
}

check() {
  meson test -C build
}

package() {
  DESTDIR="$pkgdir" meson install -C build
}
